package practicedemo33;

public class PhoneTest {
    public static void main(String[] args) {
        Phone[] arr = new Phone[3];
        arr[0] = new Phone("苹果","银色",8000.0);
        arr[1] = new Phone("红米","橄榄绿",4000.0);
        arr[2] = new Phone("华为","红色",7000.0);
        for (int i = 0; i < arr.length; i++) {
            System.out.printf("品牌:\t"+arr[i].getBrand()+'\t'+"价格:\t"+arr[i].getPrice()+'\t'+"颜色:\t"+arr[i].getColor()+'\n');
        }
        Average(arr[0].getPrice(),arr[1].getPrice(),arr[2].getPrice());
    }
    public static void Average(double price1,double price2,double price3){
        System.out.printf("手机平均价格：%.2f",(price1+price2+price3)/3.0);
    }
}
